home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / gnustuff / tos / progut~1 / iostream.zoo / test / t1.cc < prev    next >
Encoding:
C/C++ Source or Header  |  1991-09-22  |  511 b   |  32 lines

  1. #include <iostream.h>
  2. #include <assert.h>
  3. #include <stdio.h>
  4.  
  5. main ()
  6. {
  7.   char ch;
  8.   int i;
  9.   
  10.   filebuf finbuf;
  11.   finbuf.open("ffile", ios::in);
  12.   istream fin(&finbuf);
  13.   assert(fin.good());
  14.   assert(fin.is_open());
  15.   assert(!fin.writable());
  16.   assert(fin.readable());
  17.   cout << "contents of file:\n";
  18.  
  19.   do
  20.   {
  21.       i = ((fin >> ch) ? 1 : 0);
  22.       fprintf(stderr, "i is %d\n", i);
  23.       if(!i)
  24.       break;
  25.       cout << ch;
  26.   } while(1);
  27.   
  28.   fin.close();
  29.   assert(!fin.is_open());
  30.   cout << "\nAlldone\n";
  31. }
  32.